home *** CD-ROM | disk | FTP | other *** search
- ; Search - this routine is gener
- ClearAll
- Clear
- if ISfile("SAVEVARS.sc")
- then
- Play "savevars"
- else
- message "Editor error Savevares not written to disk!!!! - back to edit"
- sleep 1000
- Return
- endif
-
- @2,2 ?? "Loading structure to display.."
- {Tools} {Info} {Structure} ; routine which will load data types
- select tblname
- lcv = 1 ; and variables names
- maxn = nrecords("struct") ; lcv = loop control variable
- ; struct is table containing types and vars
-
- Edit "struct"
- Moveto [Field Name]
-
- array datavar[maxn+1] ; arrays to be loaded with variables
- array datatype[maxn+1]
-
- if maxn <> 0
- then
- while lcv <= maxn
- datavar[lcv] = [Field Name]
- Right
- datatype[lcv] = [Field Type]
- Left
- Down
- lcv = lcv +1
- endwhile ; next record or abort
- else
- ClearAll
- Clear
- Message "Error in struct file!!"
- sleep 750
- endif
-
- Do_It!
-
- While (TRUE) ;when in edit mode you can repeat various searchs until satisified
-
- Clear
-
- @1,1 ?? "Below is a list of fields that are searched: "
-
- columnwidth = 17
- maxdatawidth = 12
- maxlinelength = 70
- maxitemincol = 17
- maxcolumn=1
- lcv = 1
- column = 0
- godown = 4
-
- While ((maxcolumn <= maxlinelength) and (lcv <=maxn))
- maxlist = 1
- while ((maxlist <= maxitemincol) and (lcv <=maxn))
- decmal = maxlist + column * maxitemincol
- if len(datavar[lcv]) > maxdatawidth
- then
- @ (godown+maxlist),maxcolumn ?? decmal,"} ",substr(datavar[lcv],1,maxdatawidth)
- else
- @ (godown+maxlist),maxcolumn ?? decmal,"} ",datavar[lcv]
- endif
- maxlist = maxlist +1
- lcv = lcv +1
- endwhile
- column = column + 1
- maxlist = 1
- if (maxcolumn <= maxlinelength) ;if put in special ega mode this can be greater
- then ; for more fields but this will handle 75
- maxcolumn = maxcolumn + columnwidth
- else
- maxcolumn =1000;
- endif
- endwhile
-
- pick = -1
-
- While ((pick < 1) or ( pick > maxn))
-
- @23,1 ?? "Enter integer of field to search:"
- Accept "N" Default 1 to pick
-
- endwhile ; protects against PDX overflow since array out of bounds
-
- Message "Chosen field: ",datavar[pick]
-
- @23,1 ?? "Enter string(must be exact):"
- Accept datatype[pick] to thestring
-
- @23,1 ?? " "
- @23,1 ?? "Last chance to abort search!! Enter ** to abort:"
- Accept "A2" default "go" to srchquit
-
- if srchquit = "**"
- then
- ClearAll
- View tblname
- return
- endif
-
- ; a good data base adminstrator will have a printout of codes to search
- ; or strings that are unique to each record for people who use the editor
- ; and data entry modes often, so entering the exact string is a simple
- ; matter
-
- ; search - this covers many error conditions one many encounter
-
- ClearAll
- Clear
- @2,2 ?? "Searching... if not found will goto start of file"
- View tblname
- ; FormKey
- ; MOVETO datavar[pick]
-
- right ; number of rec field
- for lcv From 1 to (pick-1) ;when bug in 1.1 fixed use moveto commented out
- right ; above should work accord to regular expression
- endfor ; manual - this section code is not necessar
- ; if user does not change cursor postion in a
- FormKey ; a record that has been found, locate is field
- LOCATE thestring ; specific using active field as key search source
- if retval = True
- then
- peekmore = "N"
- Wait Record
- Message "Enter 'Y' for next occurance or 'N' to stop"
- Until "Y","N","y","n"
- if ((retval = "Y") or (retval = "y"))
- then
- testval = True
- while ( ((retval = "Y") or (retval = "y")) and (testval = True) )
- Recvalue = recno() + 1
- moveto record recvalue
-
- ; moveto datavar[pick]
-
- FormKey
- CtrlHome ; when moveto gets fixed remove this seciton with
- right ; replacement statement function
- for lcv from 1 to (pick-1)
- right
- endfor
- FormKey
-
- LOCATE Next thestring
- testval = retval
- if testval = True
- then
- wait record
- message " 'Y' for next item 'N' to return to edit"
- until "Y","N","y","n"
- endif
- if ((nrecords(tblname)=recno()) or (testval=False))
- then
- testval = False
- Message "End of File encountered/Item not found"
- endif
- endwhile
- endif
- endif
- Clear
- Message "Search Complete..."
- Clear
- @2,2 ?? "Would you like another search(Y/N)?:"
- accept "A1" to edmore
- if ((edmore <> "y") and (edmore <> "Y"))
- then
- return
- endif
-
- endwhile ; while repeat in edit mode
-